import request from "@/util/http";

// 获取帖子列表
export function getTieziList(params) {
  console.log('请求帖子列表参数:', params);
  return request({
    url: '/admin/tiezis',
    method: 'get',
    params
  }).catch(error => {
    console.error('获取帖子列表请求错误:', error);
    throw error;
  });
}

// 删除帖子
export function deleteTiezi(id) {
  return request({
    url: `/admin/tiezis/${id}`,
    method: 'delete'
  });
}

// 更新帖子
export function updateTiezi(id, data) {
  return request({
    url: `/admin/tiezis/${id}`,
    method: 'put',
    data
  });
}

// 获取帖子详情
export function getTieziDetail(id) {
  return request({
    url: `/admin/tiezis/${id}`,
    method: 'get'
  });
}